/*
package cn.com.mall.gateway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

*/
/** 自定义局部过滤器 *//*

@Component
public class MyParamGatewayFilterFactory extends
        AbstractGatewayFilterFactory<MyParamGatewayFilterFactory.Config> {

    private static final String PARAM_KEY = "param";

    */
/** 定义构造器(必须) *//*

    public MyParamGatewayFilterFactory(){
        super(Config.class);
    }

    */
/** 接收过滤器传进来的字段集合(可选) *//*

    @Override
    public List<String> shortcutFieldOrder() {
        return Arrays.asList(PARAM_KEY);
    }

    */
/** 重写拦截方法(必须) *//*

    @Override
    public GatewayFilter apply(Config config) {
        return (exchange, chain) -> {
            // 获取请求对象
            ServerHttpRequest request = exchange.getRequest();
            // 获取请求参数 http://localhost:10010/api/user/get/2?name=zhangsan&age=30
            if (request.getQueryParams().containsKey(config.param)){
                request.getQueryParams().get(config.param).forEach(value -> {
                    System.out.println(config.param + " = " + value);
                });
            }
            // 放行
            return chain.filter(exchange);
        };
    }

    */
/** 定义配置类，接收配置文件中的属性(必须) *//*

    public static class Config {
        private String param;
        public String getParam() {
            return param;
        }
        public void setParam(String param) {
            this.param = param;
        }
    }
}*/
